package com.chhlz.module.base.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;

/***
 * 菜式实体
 * @author ALEXGORDON
 *
 */
@Entity
@Table(name="DISH")
@DynamicInsert(true)
@DynamicUpdate(true)
public class Dish {
	private int dishId;
	private String dishName;
	private String currentPrice;
	private String description;
	private DishCategory dishCategory = new DishCategory();

	@Id
	@Column(name = "dish_id",  nullable = false, length = 11)
	@GeneratedValue(generator = "generator") 
	@GenericGenerator(name = "generator", strategy = "increment") 	
	
	public int getDishId() {
		return dishId;
	}
	public void setDishId(int dishId) {
		this.dishId = dishId;
	}
	@Column(name = "dish_name", nullable = false, length = 50)
	
	public String getDishName() {
		return dishName;
	}
	public void setDishName(String dishName) {
		this.dishName = dishName;
	}
	@Column(name = "current_price",length = 10)
	
	public String getCurrentPrice() {
		return currentPrice;
	}
	public void setCurrentPrice(String currentPrice) {
		this.currentPrice = currentPrice;
	}
	@Column(name = "description", length = 255)
	
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	@ManyToOne
	@JoinColumn(name="dish_category_id")
	public DishCategory getDishCategory() {
		return dishCategory;
	}
	public void setDishCategory(DishCategory dishCategory) {
		this.dishCategory = dishCategory;
	}
	@Override
	public String toString() {
		return "Dish [dishId=" + dishId + ", dishName=" + dishName
				+ ", currentPrice=" + currentPrice + ", description="
				+ description + ", dishCategory=" + dishCategory + "]";
	}
	
}
